﻿using System.Data.SqlClient;

namespace DBAccessTestFramework
{
    /// <summary>
    /// Helper methods when working with a MS-SQL Server database.
    /// </summary>
    public static class SqlServerHelper
    {
        /// <summary>
        /// Executes a SQL command.
        /// </summary>
        /// <param name="connectionString">A connection string</param>
        /// <param name="command">A script to execute</param>
        public static void ExecuteCommand(string connectionString, string command)
        {
            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                using (SqlCommand comm = new SqlCommand(command, conn))
                {
                    comm.ExecuteNonQuery();
                }
            }
        }
    }
}
